package com.jrj.util;

import java.util.Locale;
import java.util.ResourceBundle;
/**
 * ������--���ػ�
 * @author Administrator
 *
 */
public class ConfigUtil {
	private static final String file = "config";

	private static final ConfigUtil instance = new ConfigUtil();
	/**
	 * ����ʵ��
	 * @return
	 */
	public static ConfigUtil getInstance() {
		return instance;
	}
	/**
	 * ��ȡ��Դ��
	 * @param file
	 * @return
	 */
	public ResourceBundle loadFile(String file) {
		try {
			return ResourceBundle.getBundle(file, Locale.ENGLISH);
		} catch (Exception e) {
			e.printStackTrace();
			System.err.println("[Property]:Can't Load property.properties");
			return null;
		}
	}
	/**
	 * ��ȡ��Դ���Ӧ��value
	 * @param key
	 * @return
	 */
	public String getString(String key) {
		try {
			String value = loadFile(file).getString(key);
			return value;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}
